# encoding:utf-8
import requests

# client_id 为官网获取的AK， client_secret 为官网获取的SK
# 图形识别
# AK='2cWtQZysQGbEgoat2gpGexFx'
# SK='TkZuIxm6tnLlCaFohdEmcSdhPbRfP9wt'

# 文字识别
# AK='lOGIQMXWiP3AzY18A9GX4GjU'
# SK='0n6Nba2QQhBHGyUqQabj1uAlA475G8GO'


# easydl识别
AK='lqTjZ1XGYqBZ3oN1xIwHf6An'
SK='MXe2b7kP4KPGEhNIjLNRkMzUFYW6P7vW'





host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={AK}&client_secret={SK}'\
    .format(AK=AK,SK=SK)
response = requests.get(host) # 发起get请求
print(response)
if response:
    result=response.json()
    print(type(result))
    print(result['access_token'])
    print(result['expires_in']) #30天有效


'''
access_token:24.59b5b3716b1e5b050e998aefadf61767.2592000.1603529392.282335-16179300
2020-9-24  图像识别
'''

'''
access_token:24.22de20d40849855c8d4f32894fb90404.2592000.1603596188.282335-16510676
2020-9-25  文字识别
'''

'''
access_token:24.257a0d822d12f028923e94f818ed8825.2592000.1603606798.282335-17193409
2020-9-25  垃圾分类
'''